package com.mind.common.utils.file.vo;

import com.alibaba.fastjson2.JSONArray;
import com.mind.common.utils.StringUtils;
import com.mind.common.utils.file.FileUtils;

import java.io.IOException;
import java.util.List;

public class FileVo {
    public FileVo() {
    }
    public FileVo(String base64) {
        this.base64 = base64;
    }
    // /api/file/{buketName}/{objectName}
    private String base64;

    private String apiUrl;

    private String filePath;

    private String fileName;

    private String sourceUrl;

    private List<FileVo> children;

    private JSONArray boxes;

    private JSONArray texts;
    public String parseBase64Url() throws IOException {
        if(StringUtils.isEmpty(base64))
            base64 = FileUtils.file2Base64(filePath);
        return base64;
    }

    public String getApiUrl() {
        return apiUrl;
    }

    public void setApiUrl(String apiUrl) {
        this.apiUrl = apiUrl;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getSourceUrl() {
        return sourceUrl;
    }

    public void setSourceUrl(String sourceUrl) {
        this.sourceUrl = sourceUrl;
    }

    public List<FileVo> getChildren() {
        return children;
    }

    public void setChildren(List<FileVo> children) {
        this.children = children;
    }

    public JSONArray getBoxes() {
        return boxes;
    }

    public void setBoxes(JSONArray boxes) {
        this.boxes = boxes;
    }

    public JSONArray getTexts() {
        return texts;
    }

    public void setTexts(JSONArray texts) {
        this.texts = texts;
    }
}
